package edu.jmu.action.permanage;

import java.io.Serializable;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import edu.jmu.action.BaseAction;
import edu.jmu.bean.PageView;
import edu.jmu.bean.user.Depart;
import edu.jmu.service.user.DepartService;

@Controller
@Scope(value="prototype")
public class DepartManageAction extends BaseAction<Depart> {
	private static final long serialVersionUID = 8635602706935353541L;

	@Resource
	private DepartService departService;
	private Depart depart;
	private Integer[] delId;
	
	public String listDepart(){
		pageView = new PageView<Depart>(maxresult,currentpage);
		pageView.setQueryResult(departService.getScrollData(pageView.getFirstResult(), pageView.getMaxresult()));
		return SUCCESS;
	}
	
	public String addDepart(){		
		departService.save(depart);
		return SUCCESS;
	}
	
	public String deleteDepart(){
		departService.delete((Serializable[])delId);
		return SUCCESS;
	}
	
	public String updateDepart(){
		departService.update(depart);
		return SUCCESS;
	}

	public void setDelId(Integer[] delId) {
		this.delId = delId;
	}
	
	
}
